class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.column :group_id, :integer
      t.column :login, :string
      t.column :email, :string
      t.column :lang, :string
      t.column :crypted_password, :string, :limit => 40
      t.column :salt, :string, :limit => 40
      t.column :created_at, :datetime
      t.column :updated_at, :datetime
      t.column :topics_count, :integer, :default => 0
      t.column :posts_count, :integer, :default => 0
      t.column :remember_token, :string
      t.column :remember_token_expires_at, :datetime
      t.column :activation_code, :string, :limit => 40
      t.column :activated_at, :datetime
    end
    
    add_index :users, :group_id
  end

  def self.down
    drop_table :users
  end
end
